<template>
  <NSwitch v-model:value="ageVisible" />
  <NvCrud :option :data />
</template>

<script setup lang="tsx">
import type { NvCrudOption } from 'nv-crud'
import { NSwitch } from 'naive-ui'
import { NvCrud } from 'nv-crud'
import { ref } from 'vue'

const ageVisible = ref(false)

const data = [{ name: '张三', sex: '男', age: 18 }]

const option: NvCrudOption = {
  rowActions: false,
  actionbar: false,
  toolbar: false,
  fields: {
    name: {
      title: '姓名',
    },
    sex: {
      title: '性别',
      visible: false,
    },
    age: {
      title: '年龄',
      visible: ageVisible,
    },
  },
}
</script>
